<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\common\model;

use app\common\model\Base;
use think\Db;

class ThreadColumn extends Base {

    
    
    
    public function getPublishTypeTextAttr($value, $data) {
        if($data['publish_type'] == 0){
            return '所有人';
        }elseif($data['publish_type'] == 1){
            return '仅管理员';
        }
    }
    
    public function getJoinTypeTextAttr($value, $data) {
        if($data['join_type'] == 0){
            return '所有人';
        }elseif($data['join_type'] == 1){
            return '按VIP级别';
        }elseif($data['join_type'] == 2){
            return '按积分值';
        }
    }
    

    public function model_where() {

        if (request()->get('keyword'))
            $this->where('title', 'like', '%' . request()->get('keyword') . '%');

        $this->order('id desc');

        return $this;
    }

}
